#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int maxArea(int* height, int heightSize) {
    int right = heightSize - 1, left = 0;
    int k = 0,v=0;
    int max = 0;
    while (left < right)
    {
        if (height[left] > height[right])
        {
            v= height[right] * (right - left);
            right--;
        }
        else
        {
            v = height[left] * (right - left);
            left++;
        }
        if (v > max)
            max = v;
    }

    return max;
}
int main()
{
    int height[9] = { 1,8,6,2,5,4,8,3,7 };
    int heightSize = 9;
    printf("%d", maxArea(height, heightSize));


    return 0;
}